package com.xhx.service.animals.impl;

import com.xhx.config.DataSource;
import com.xhx.config.DynamicDataSource;
import com.xhx.dao.alluse.DogMapper;
import com.xhx.model.animals.Dog;
import com.xhx.model.utils.PagingModel;
import com.xhx.service.animals.DogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("dogServiceImpl")
public class DogServiceImpl implements DogService {

    @Autowired
    DogMapper dogMapper;


    @Override
    public Map<String, Object> findDog(Integer id) {
        Map dog = dogMapper.findDog(id);
        return dog;
    }

    @Override
    @DataSource("mysql2DataSource")
    public Map<String, Object> findADog(Integer id) {
        Map dog = dogMapper.findDog(id);
        return dog;
    }
    @Override
    public int addDog(Dog dog) {
        return dogMapper.addDog(dog);
    }

    @Override
    public int udpDog(Dog dog) {
        return dogMapper.updDog(dog);
    }

    @Override
    public int delDog(Integer id) {
        return dogMapper.delDog(id);
    }

    @Override
    public List<Dog> findDogs(PagingModel pagingModel, Dog filterModel) {
        return dogMapper.findDogs(pagingModel,filterModel);
    }
}
